"""

@File:user_service.py
@Datetime:2022/11/6 22:46
@Author:wangt
@Desc:
"""
import json

from api.base_service import BaseService


class UserService(BaseService):
    def __init__(self):
        super().__init__()
        self.service_name = "UserService"

    def find_by_username(self,username):
        """
        功能：查询管理员
        :param username:输入管理员username参数，如："admin"
        :return: 成功返回字典数据，失败返回
        """
        resp = self.dubbo_client.invoke("UserService", "findByUsername", username)
        if resp == "null":
            return None
        else:
            return json.loads(resp)


if __name__ == '__main__':
    us = UserService()
    # username = "admin"
    resp = us.find_by_username("admin")
    print(resp,type(resp))
